package scu.maqiang.mesh;

import java.util.HashSet;

import scu.maqiang.numeric.UnorderIntArray;

/**
 * 二维两结点有限元, 用于模拟二维杆, 梁结构
 * 
 * @author 马强
 *
 */
public class Mesh2L2 extends Mesh {

	public Mesh2L2() {
		super();
		nDim = 2;
		nPerElement = 2;
		nPerBoundary = 1;
		nEdgePerElement = 1;
		nEdgePerBoundary = 0;
		tecplotType = "FELINESEG";
		nBoundaryPerElement = 2;
	}

	@Override
	public double[] getinteriorPointInElement(double[][] coord) {
		return new double[] { 0.5 * (coord[0][0] + coord[1][0]), 0.5 * (coord[0][1] + coord[1][1]) };
	}

	@Override
	public double[] getinteriorPointOnBoundary(double[][] coord) {
		return new double[] { coord[0][0], coord[0][1] };
	}

	@Override
	public int[][] getBoundarysFromElement(int i) {
		int[][] boundary = new int[nBoundaryPerElement][];
		int[] ele = elements[i];
		boundary[0] = new int[] { ele[0] };
		boundary[1] = new int[] { ele[1] };
		return boundary;
	}

	@Override
	public boolean checkMesh(double[][] coord) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int getTecplotNt() {
		return nt;
	}

	@Override
	public int[][] getEdgesFromElement(int i) {
		int[] ele = elements[i].clone();
		return new int[][] { ele };
	}
}
